package org.myorg.v4;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

public class TestI4 extends Para4 {
	
	public void RW()throws Exception {
		FPeopleWritable4 all_p = new FPeopleWritable4(ipn,igl);
		ifc.caculate(all_p.getPersons());
		double value = all_p.getBest().fitness;  
		
		
		FPeople4[] ap = all_p.seg(imn);

		Configuration conf = new Configuration();
		FileSystem fs = FileSystem.get(conf);
		Path f = new Path(iin + "/0");			
		FSDataOutputStream out = fs.create(f, true, 0);
		for (int j = 0; j < imn; j++) {
			new FPeopleWritable4(ap[j]).write(out);
		}
		out.close();
		
		fs = FileSystem.get(conf);
		f = new Path(iin + "/0");
		FSDataInputStream fileIn = fs.open(f);
		FPeopleWritable4[] rp = null;
		
		for (int j = 0; j < imn; j++) {
			rp[j] = new FPeopleWritable4();
			rp[j].readFields(fileIn);
		}
		
		
		
	}
	public static void main(String[] args) throws Exception {
		
	}
}
